home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
c
/
mc51bugs.zip
/
Q33901
< prev
next >
Wrap
Text File
|
1988-08-09
|
2KB
|
53 lines
Q33901 Code Generation Problem Caused by /Oal Optimization
C Compiler
5.10 | 5.10
MS-DOS | OS/2
Summary:
A structure is allocated in long heap by using the C run-time
routine malloc. A local structure is declared allocating the
structure in the default data segment.
The optimization problem occurs inside a for loop on the assignment
of the local structure member to the far-allocated structure member.
The C source code was compiled with alias checking and /Oal loop
optimization.
The code generated on the assignment is incorrect. The segment
register DS is incorrectly set equal to ES.
A workaround is to use an optimization switch not containing alias
checking or loop optimization. For example, the optimization switches
/Oait or /Olit can be used, but /Oailt cannot be used.
Microsoft has confirmed this to be a problem in Version 5.10 of
the C Compiler. We are researching this problem and will post new
information as it becomes available.
More Information:
The following program illustrates the problem:
#include <malloc.h>
typedef struct { double i; double r; } complex;
main(){
complex foo;
foo.i=999.999;
foo.r=999.999;
sub(foo);
}
int sub(in)
complex in;
{
int x;
complex *cp;
cp = malloc(8192);
for (x=0;x<512;x++) {
cp[x].i=x;
cp[x].r=x;
cp[x].i = in.i;
cp[x].r = in.r;
}
}
Keywords: buglist5.10
Updated 88/08/09 05:59